*****************************************************************
*                                                               *
*                                                               *
*                   REPLICATION FILES FOR:                      *
*                                                               *
*                    Endogenous Democracy:                      *
*  Causal Evidence from the Adoption of Potato in the Old World *                           
*                                                               *
*				    *Sensitivity Analysis*                      *
*                                                               *          
*                                                               *
*                                                               *
*****************************************************************

**********************************
* Set working directory and data *
**********************************

*cd ""

use "potato_data.dta", clear

**********************************
*       Flexible variables       *
**********************************

local ln_potato_flexible "ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900"
local ln_oworld_flexible "ln_oworld_1100 ln_oworld_1200 ln_oworld_1300 ln_oworld_1400 ln_oworld_1500 ln_oworld_1600 ln_oworld_1700 ln_oworld_1750 ln_oworld_1800 ln_oworld_1850 ln_oworld_1900"
local ln_tropical_flexible "ln_tropical_1100 ln_tropical_1200 ln_tropical_1300 ln_tropical_1400 ln_tropical_1500 ln_tropical_1600 ln_tropical_1700 ln_tropical_1750 ln_tropical_1800 ln_tropical_1850 ln_tropical_1900"
local ln_rugged_flexible "ln_rugged_1100 ln_rugged_1200 ln_rugged_1300 ln_rugged_1400 ln_rugged_1500 ln_rugged_1600 ln_rugged_1700 ln_rugged_1750 ln_rugged_1800 ln_rugged_1850 ln_rugged_1900"
local ln_elevation_flexible "ln_elevation_1100 ln_elevation_1200 ln_elevation_1300 ln_elevation_1400 ln_elevation_1500 ln_elevation_1600 ln_elevation_1700 ln_elevation_1750 ln_elevation_1800 ln_elevation_1850 ln_elevation_1900"

*****************************************
* Appendix D: Descriptive Statistics 	*
*										*
*****************************************

summarize lead_polity city_pop_share ln_wpot_1900 ln_oworld_1900 ln_tropical_1900 ln_rugged_1900 ln_elevation_1900

*****************************************
* Appendix E: Sensitivity Analysis 		*
*										*
* WARNING: Models may take hours to run *
*****************************************

****Estimate reduced-form equations to set sensible bounds for gamma****

regress lead_polity city_pop_share ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900 i.year i.country
display (_b[ln_wpot_1700] + _b[ln_wpot_1750] + _b[ln_wpot_1800] + _b[ln_wpot_1850] + _b[ln_wpot_1900])/5

regress lead_polity city_pop_share ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900 `ln_oworld_flexible' i.year i.country
display (_b[ln_wpot_1700] + _b[ln_wpot_1750] + _b[ln_wpot_1800] + _b[ln_wpot_1850] + _b[ln_wpot_1900])/5

regress lead_polity city_pop_share ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900 `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country
display (_b[ln_wpot_1700] + _b[ln_wpot_1750] + _b[ln_wpot_1800] + _b[ln_wpot_1850] + _b[ln_wpot_1900])/5

****Original IV models with strict exogeneity assumption (Replication of Table 1)****
**Column 1**
ivregress 2sls lead_polity (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900) i.year i.country, level(90)

**Column 2**
ivregress 2sls lead_polity (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900) `ln_oworld_flexible' i.year i.country, level(90)

**Column 3**
ivregress 2sls lead_polity (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900) `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country, level(90)


************************************************************
*        Models with plausible exogenous IV				   *
*  at distinct size of the exclusion restriction violation *
*            (all CIs are one-tailed)					   *
************************************************************

********************************************************
*  10% of the reduced-form estimated effect at 95% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024) vce(cluster country)


********************************************************
*  10% of the reduced-form estimated effect at 90% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046,0.046) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024,0.024) vce(cluster country)


********************************************************
*  20% of the reduced-form estimated effect at 95% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048)vce(cluster country)

********************************************************
*  20% of the reduced-form estimated effect at 90% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092,0.092) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048,0.048) vce(cluster country)

********************************************************
*  30% of the reduced-form estimated effect at 95% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072) vce(cluster country)

********************************************************
*  30% of the reduced-form estimated effect at 90% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138,0.138) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072,0.072) vce(cluster country)

********************************************************
*  40% of the reduced-form estimated effect at 95% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096) vce(cluster country)

********************************************************
*  40% of the reduced-form estimated effect at 90% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184,0.184) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096,0.096) vce(cluster country)

********************************************************
*  60% of the reduced-form estimated effect at 95% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.9) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144) vce(cluster country)


********************************************************
*  60% of the reduced-form estimated effect at 90% CI  *
********************************************************

**Column 1**
plausexog uci lead_polity i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30,0.30) vce(cluster country)

**Column 2**
plausexog uci lead_polity `ln_oworld_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336,0.336) vce(cluster country)

**Column 3**
plausexog uci lead_polity `ln_oworld_flexible' `ln_tropical_flexible' `ln_rugged_flexible' `ln_elevation_flexible' i.year i.country (city_pop_share = ln_wpot_1100 ln_wpot_1200 ln_wpot_1300 ln_wpot_1400 ln_wpot_1500 ln_wpot_1600 ln_wpot_1700 ln_wpot_1750 ln_wpot_1800 ln_wpot_1850 ln_wpot_1900), level(0.8) gmin(0,0,0,0,0,0,0,0,0,0,0) gmax(0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144,0.144) vce(cluster country)
